/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controlo;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import utilizador_bd.ConectBD;

/**
 *
 * @author Daniel
 */
public class ControloClientes {
     ConectBD conectclientes = new ConectBD();
    public void Inserircliente(modelo.Modelo_clientes client){

        conectclientes.conexao();
        try {
            PreparedStatement pst = conectclientes.con.prepareStatement("insert into clientes(nrcartao,nome, concelho,morada,telefone)value(?,?,?,?,?) ");
            pst.setString(1, client.getNrcartao());
            pst.setString(2, client.getNome());
            pst.setString(3, client.getConcelho());
            pst.setString(4, client.getMorada());
            pst.setString(5, client.getTelefone());
            

           

            pst.execute();
            JOptionPane.showMessageDialog(null, "Dados armazenados com sucesso!");
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Erro na inserção de dados!"+ex.getMessage());
        }
                     
         
}
    
}
